﻿using System;

namespace KuiHuaBaoDian.Services.Guide {

    public interface IGuideTrigger {
    }

    public interface IGuideTriggerKey {
    }

    /// <summary>
    /// 新手引导触发器
    /// </summary>
    [NodeAcceptInput(typeof(GuideStart_When))]
    [NodeAcceptInput(typeof(GuideTriggerAnd))]
    public abstract class GuideTrigger : GuideEntity, IGuideTrigger, IGuideEntityHasInput, IGuideEntityHasOutput {

        /// <summary>
        /// 为<see cref="Type"/>为<see cref="GuideTriggerType.Validate"/>类型的触发器提供一个验证是否触发的函数
        /// </summary>
        /// <returns>如果验证成功返回<code>true</code>，否则<code>false</code></returns>
        /// <exception cref="NotImplementedException">如果<see cref="Type"/>类型为<see cref="GuideTriggerType.Validate"/>时没有覆盖此函数则抛出异常</exception>
        public virtual bool Validate() => true;

        /// <summary>
        /// 当<see cref="Type"/>为<see cref="GuideTriggerType.Trigger"/>或<see cref="GuideTriggerType.State"/>时需要一个可被外被输入的触发Key,<see cref="GuideTriggerType.Validate"/>则不需要
        /// </summary>
        public virtual IGuideTriggerKey Key { get; } = null;

        /// <summary>
        /// 触发类型，<see cref="GuideTriggerType.Trigger"/>或<see cref="GuideTriggerType.State"/>需要提供可比较的<see cref="Key"/>,<see cref="GuideTriggerType.Validate"/>则需要覆盖<see cref="Validate"/>函数
        /// </summary>
        public abstract GuideTriggerType Type { get; }
    }
}
